package com.copm.demonstrationsystem.controller.introductionfeatures;

import com.copm.demonstrationsystem.commons.response.ResponseStatus;
import com.copm.demonstrationsystem.commons.util.ControllerUtils;
import com.copm.demonstrationsystem.service.introductionfeatures.CompanyCultureService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: Yuan Baiyu
 * @Date: Created in 22:20 2018/4/24
 */
@RestController
@RequestMapping("/culture")
@CrossOrigin
public class CompanyCultureController {

    @Autowired
    CompanyCultureService companyCultureService;

    //获取“企业文化”页面信息
    @ApiOperation("公司文化 页面的信息获取接口")
    @GetMapping
    ResponseStatus getPage() {
        return ControllerUtils.fillResponse(new ResponseStatus(),
                companyCultureService.getPage());
    }

//

    //添加“企业文化”页面标签文本
    @ApiOperation("标签文本 添加")
    @ApiImplicitParams({@ApiImplicitParam(name = "title",value = "待添加的标签文本内容"
            ,dataType = "String",paramType = "query",required = true),
            @ApiImplicitParam(name = "seq",value = "待添加的标签文本内容的序列编号"
                    ,dataType = "Long",paramType = "path",required = true)})
    @PostMapping("/title/{seq}")
    ResponseStatus addCompanyCultureTitle(@RequestParam("title") String title,@PathVariable("seq") Long seq) {
        return ControllerUtils.fillResponse(new ResponseStatus(),
                companyCultureService.addCompanyCultureTitle(title,seq));
    }

    //添加“企业文化”页面内容文本
    @ApiOperation("内容文本 添加")
    @ApiImplicitParams({@ApiImplicitParam(name = "content",value = "待添加的内容文本内容"
            ,dataType = "String",paramType = "query",required = true),
            @ApiImplicitParam(name = "seq",value = "待添加的标签文本内容的序列编号"
                    ,dataType = "Long",paramType = "path",required = true)})
    @PostMapping("/content/{seq}")
    ResponseStatus addCompanyCultureContent(@RequestParam("content") String content,@PathVariable("seq") Long seq) {
        return ControllerUtils.fillResponse(new ResponseStatus(),
                companyCultureService.addCompanyCultureContent(content,seq));
    }


    //删除“企业文化”页面标签文本
    @ApiOperation("标签文本 删除")
    @ApiImplicitParam(name = "id",value = "待删除的标签文本标识ID"
            ,dataType = "Long",paramType = "path",required = true)
    @DeleteMapping("/title/{id}")
    ResponseStatus deleteCompanyCultureTitle(@PathVariable("id") Long id) {
        return ControllerUtils.fillResponse(new ResponseStatus(),
                companyCultureService.deleteCompanyCultureTitle(id));
    }

    //删除“企业文化”页面内容文本
    @ApiOperation("内容文本 删除")
    @ApiImplicitParam(name = "id",value = "待删除的内容文本标识ID"
            ,dataType = "Long",paramType = "path",required = true)
    @DeleteMapping("/content/{id}")
    ResponseStatus deleteCompanyCultureContent(@PathVariable("id") Long id) {
        return ControllerUtils.fillResponse(new ResponseStatus(),
                companyCultureService.deleteCompanyCultureContent(id));
    }

    //修改“企业文化”页面演示图片
    @ApiOperation("演示图片 修改")
    @ApiImplicitParam(name = "file",value = "新的演示图片"
            ,dataType = "file",paramType = "form",required = true)
    @PostMapping("/demonstrationimage")
    ResponseStatus modifyCompanyCultureDemonstrationImage(@RequestPart("file") MultipartFile file) {
        return ControllerUtils.fillResponse(new ResponseStatus(),
                companyCultureService.modifyCompanyCultureDemonstrationImage(file));
    }

    //修改“企业文化”页面背景图片
    @ApiOperation("背景图片 修改")
    @ApiImplicitParam(name = "file",value = "新的背景图片"
            ,dataType = "file",paramType = "form",required = true)
    @PostMapping("/backgroundimage")
    ResponseStatus modifyCompanyCultureBackgroundImage(@RequestPart("file") MultipartFile file) {
        return ControllerUtils.fillResponse(new ResponseStatus(),
                companyCultureService.modifyCompanyCultureBackgroundImage(file));
    }

    //修改“企业文化”页面标签文本
    @ApiOperation("标签文本 修改")
    @ApiImplicitParams({@ApiImplicitParam(name = "title",value = "新标签文本内容"
            ,dataType = "String",paramType = "query",required = true),
            @ApiImplicitParam(name = "id",value = "待修改的标签文本标识ID"
                    ,dataType = "Long",paramType = "path",required = true)})
    @PutMapping("/title/{id}")
    ResponseStatus modifyCompanyCultureTitle(@PathVariable("id") Long id, @RequestParam("title") String title) {
        return ControllerUtils.fillResponse(new ResponseStatus(),
                companyCultureService.modifyCompanyCultureTitle(id, title));
    }

    //修改“企业文化”页面内容文本
    @ApiOperation(" 内容文本 修改")
    @ApiImplicitParams({@ApiImplicitParam(name = "content",value = "新内容文本内容"
            ,dataType = "String",paramType = "query",required = true),
            @ApiImplicitParam(name = "id",value = "待修改的内容文本标识ID"
                    ,dataType = "Long",paramType = "path",required = true)})
    @PutMapping("/content/{id}")
    ResponseStatus modifyCompanyCultureContent(@PathVariable("id") Long id, @RequestParam("content") String content) {
        return ControllerUtils.fillResponse(new ResponseStatus(),
                companyCultureService.modifyCompanyCultureContent(id, content));
    }



    //    //删除“企业文化”页面演示图片
//    @ApiOperation("演示图片 删除")
//    @DeleteMapping("/demonstrationimage")
//    ResponseStatus deleteCompanyCultureDemonstrationImage() {
//        return ControllerUtils.fillResponse(new ResponseStatus(),
//                companyCultureService.deleteCompanyCultureDemonstrationImage());
//    }
//
//    //删除“企业文化”页面背景图片
//    @ApiOperation("背景图片 删除")
//    @DeleteMapping("/backgroundimage")
//    ResponseStatus deleteCompanyCultureBackgroundImage() {
//        return ControllerUtils.fillResponse(new ResponseStatus(),
//                companyCultureService.deleteCompanyCultureBackgroundImage());
//    }

    //添加“企业文化”页面演示图片
//    @ApiOperation("演示图片 添加")
//    @ApiImplicitParam(name = "file",value = "待添加的演示图片"
//            ,dataType = "file",paramType = "form",required = true)
//    @PostMapping("/demonstrationimage")
//    ResponseStatus addCompanyCultureDemonstrationImage(@RequestPart("file") MultipartFile file) {
//        return ControllerUtils.fillResponse(new ResponseStatus(),
//                companyCultureService.addCompanyCultureDemonstrationImage(file));
//    }
//
//    //添加“企业文化”页面背景图片
//    @ApiOperation("背景图片 添加")
//    @ApiImplicitParam(name = "file",value = "待添加的背景图片"
//            ,dataType = "file",paramType = "form",required = true)
//    @PostMapping("/backgroundimage")
//    ResponseStatus addCompanyCultureBackgroundImage(@RequestPart("file") MultipartFile file) {
//        return ControllerUtils.fillResponse(new ResponseStatus(),
//                companyCultureService.addCompanyCultureBackgroundImage(file));
//    }
}
